package com.rogan.rea;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Client1 {
public static void main(String[] args) {
	try {
		Socket so   = new Socket("127.0.0.1", 8080);
		OutputStream out = so.getOutputStream();
		InputStream in = so.getInputStream();
		
		out.write("hello".getBytes());
		
		byte[] b = new byte[1024];
		String s = "";
		int i = 0;
		while( (i = in.read(b )) >0) {
			s+= new String(b);
			if (i < 1024) {
				break;
			}
		}
		System.out.println(s);
		so.close();
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
}
}
